using System.ComponentModel.DataAnnotations;
using SqlSugar;

namespace FytSoa.Domain.Car;

/// <summary>
/// 游戏设置表
/// </summary>
[SugarTable("cars_game")]
public class CarsGame:Entity
{
    /// <summary>
    /// 游戏名称
    /// </summary>
    [Required]
    [StringLength(50)]
    public string Name { get; set; }

    /// <summary>
    /// 状态
    /// </summary>
    [Required]
    public bool Status { get; set; } = true;

    /// <summary>
    /// 规则
    /// </summary>
    public string Summary { get; set; }

    /// <summary>
    /// 配置相关获得积分策略
    /// </summary>
    [SugarColumn(IsJson = true)]
    public List<CarsGameRuleLevel> ConfigRule { get; set; }

    /// <summary>
    /// 添加时间
    /// </summary>
    [Required]
    public DateTime AddTime { get; set; }=DateTime.Now;

    /// <summary>
    /// 规则级别
    /// </summary>
    public class CarsGameRuleLevel
    {
        /// <summary>
        /// 等级
        /// </summary>
        public int Level { get; set; }
        
        public List<CarsGameRuleItem> Rule { get; set; }
    }
    
    /// <summary>
    /// 规则详情
    /// </summary>
    public class CarsGameRuleItem
    {
        /// <summary>
        /// 最小值
        /// </summary>
        public int Min { get; set; }
        
        /// <summary>
        /// 最大值
        /// </summary>
        public int Max { get; set; }
        
        /// <summary>
        /// 积分
        /// </summary>
        public int Point { get; set; }
    }
}